<template>
  <div id="comment-dom" />
</template>

<script setup>
import { onMounted } from "vue";
import { inBrowser } from "vitepress";
import Gitalk from "gitalk";

const props = defineProps({
  // 填充评论区
  fill: {
    type: [Boolean, String],
    default: false,
  },
});

const init = () => {
  if (inBrowser) {
    const gitalk = new Gitalk({
      clientID: "Ov23livaniKTYPLVYlTE",
      clientSecret: "1fe1c210b201df3273b43071d38585033f038bec",
      repo: "indulgeback-comment", // The repository of store comments,
      owner: "indulgeback",
      admin: ["indulgeback"],
      labels: ["Gitalk"],
      createIssueManually: true,
      id: decodeURIComponent(location.pathname), // Ensure uniqueness and length less than 50
    });

    gitalk.render("comment-dom");
  }
};

onMounted(() => {
  init();
});
</script>

<style></style>
